#include "../Require/Init.iss"
function main()
{
	extension -require isxeq2
	;EA "Loading" "Harvest.iss"
	if !${Me.InCombat} && !${FullInventory} && ${NextTarget} != 0
	{
		if ${Actor[${NextTarget}](exists)}
		{
			EQ2Echo Resource Node detected : ${Actor[${NextTarget}].Name}
			Target "${NextTarget}"
			wait 2
			call MoveToTargetMelee
			if ${Target.Name.Find[ore]} || ${Target.Name.Find[stone]} || ${Target.Name.Find[rock]}
			{
				call CastOnTarget "Mining"
			}
			elseif ${Target.Name.Find[arbor]} || ${Target.Name.Find[tree]} || ${Target.Name.Find[timber]} || ${Target.Name.Find[branch]} || ${Target.Name.Find[wood]} || ${Target.Name.Find[bones]}
			{
				call CastOnTarget "Foresting"
			}
			elseif ${Target.Name.Find[roots]} || ${Target.Name.Find[shrubbery]} || ${Target.Name.Find[weed]} || ${Target.Name.Find[bed]} || ${Target.Name.Find[fungus]} || ${Target.Name.Find[garden]} || ${Target.Name.Find[fungi]} || ${Target.Name.Find[ring]} || ${Target.Name.Find[foliage]} || ${Target.Name.Find[bush]}
			{
				call CastOnTarget "Gathering"
			}
			elseif ${Target.Name.Find[den]} || ${Target.Name.Find[nest]}
			{
				call CastOnTarget "Trapping"
			}
			elseif ${Target.Name.Find[fish]} || ${Target.Name.Find[trout]}
			{
				call CastOnTarget "Fishing"
			}
			elseif ${Target.Name.Find[?]}
			{
				call CastOnTarget "Collecting"
			}
			wait 5
			while ${Me.CastingSpell}
			{
				wait 2
			}
			wait 5
			call ClearTarget
			NextTarget:Set[0]
		}
	}
}
function atexit()
{
	;VirtualState:Set[ROAM]
	;EA "Unloading" "Harvest.iss"
}
